package SwingComponents;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class UserRegisterPanel extends JPanel {

    private final int buttonWidth = 100;
    private final int buttonHeight = 25;
    private JLabel usernameLabel;
    private JLabel nameLabel;
    private JLabel surnameLabel;
    private JLabel emailLabel;
    private JLabel passwordLabel;
    private JLabel repitePasswordLabel;
    private JTextField usernameTextField;
    private JTextField nameTextField;
    private JTextField surnameTextField;
    private JTextField emailTextField;
    private JPasswordField passwordField;
    private JPasswordField repitePasswordField;
    private JButton okButton;
    private JButton cancelButton;

    public UserRegisterPanel() {
        usernameLabel = new JLabel("User name");
        usernameLabel.setSize(new Dimension(buttonWidth, buttonHeight));
        usernameLabel.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        usernameLabel.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        usernameLabel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
        usernameLabel.setForeground(Color.white);
        usernameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

        nameLabel = new JLabel("Name");
        nameLabel.setSize(new Dimension(buttonWidth, buttonHeight));
        nameLabel.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        nameLabel.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        nameLabel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
        nameLabel.setForeground(Color.white);
        nameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

        surnameLabel = new JLabel("Surname");
        surnameLabel.setSize(new Dimension(buttonWidth, buttonHeight));
        surnameLabel.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        surnameLabel.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        surnameLabel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
        surnameLabel.setForeground(Color.white);
        surnameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

        emailLabel = new JLabel("E-mail");
        emailLabel.setSize(new Dimension(buttonWidth, buttonHeight));
        emailLabel.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        emailLabel.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        emailLabel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
        emailLabel.setForeground(Color.white);
        emailLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

        passwordLabel = new JLabel("Password");
        passwordLabel.setSize(new Dimension(buttonWidth, buttonHeight));
        passwordLabel.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        passwordLabel.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        passwordLabel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
        passwordLabel.setForeground(Color.white);
        passwordLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

        repitePasswordLabel = new JLabel("Repite password");
        repitePasswordLabel.setSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordLabel.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordLabel.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordLabel.setPreferredSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordLabel.setForeground(Color.white);
        repitePasswordLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

        usernameTextField = new JTextField();
        usernameTextField.setSize(new Dimension(buttonWidth, buttonHeight));
        usernameTextField.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        usernameTextField.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        usernameTextField.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        nameTextField = new JTextField();
        nameTextField.setSize(new Dimension(buttonWidth, buttonHeight));
        nameTextField.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        nameTextField.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        nameTextField.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        surnameTextField = new JTextField();
        surnameTextField.setSize(new Dimension(buttonWidth, buttonHeight));
        surnameTextField.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        surnameTextField.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        surnameTextField.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        emailTextField = new JTextField();
        emailTextField.setSize(new Dimension(buttonWidth, buttonHeight));
        emailTextField.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        emailTextField.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        emailTextField.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        passwordField = new JPasswordField();
        passwordField.setSize(new Dimension(buttonWidth, buttonHeight));
        passwordField.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        passwordField.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        passwordField.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        repitePasswordField = new JPasswordField();
        repitePasswordField.setSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordField.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordField.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        repitePasswordField.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        okButton = new JButton("Ok");
        okButton.setSize(new Dimension(buttonWidth, buttonHeight));
        okButton.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        okButton.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        okButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        cancelButton = new JButton("Cancel");
        cancelButton.setSize(new Dimension(buttonWidth, buttonHeight));
        cancelButton.setMaximumSize(new Dimension(buttonWidth, buttonHeight));
        cancelButton.setMinimumSize(new Dimension(buttonWidth, buttonHeight));
        cancelButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight));

        this.add(usernameLabel);
        this.add(usernameTextField);
        this.add(passwordLabel);
        this.add(passwordField);
        this.add(repitePasswordLabel);
        this.add(repitePasswordField);
        this.add(emailLabel);
        this.add(emailTextField);
        this.add(nameLabel);
        this.add(nameTextField);
        this.add(surnameLabel);
        this.add(surnameTextField);
        this.add(okButton);
        this.add(cancelButton);

        this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        this.setBackground(Color.BLACK);
        this.setSize(new Dimension(501, 701));
        this.setPreferredSize(new Dimension(501, 701));
        this.setMinimumSize(new Dimension(501, 701));
        this.setMaximumSize(new Dimension(501, 701));
    }

    public JTextField getUsernameTextField() {
        return usernameTextField;
    }

    public JTextField getNameTextField() {
        return nameTextField;
    }

    public JTextField getSurnameTextField() {
        return surnameTextField;
    }

    public JTextField getEmailTextField() {
        return emailTextField;
    }

    public JPasswordField getPasswordField() {
        return passwordField;
    }

    public JPasswordField getRepitePasswordField() {
        return repitePasswordField;
    }

    public JButton getOkButton() {
        return okButton;
    }

    public JButton getCancelButton() {
        return cancelButton;
    }
}
